package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/user/shop")
@RestController("userShopController")
@Api(tags = "用户端营业状态设置")
@Slf4j
@RequiredArgsConstructor
public class ShopController {

    private final StringRedisTemplate stringRedisTemplate;

    @ApiOperation("获取店铺状态")
    @GetMapping("/status")
    public Result<Integer> status(){
        String s = stringRedisTemplate.opsForValue().get("sky:shop");
        log.info("获取到的营业状态为{}",s);
        return Result.success(Integer.parseInt(s));
    }

}
